{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "所有的变形，数据来源从这个公式入手：\n",
    "$$P_0 = \\frac{D_0(1+g)}{r_{e}-g}$$\n",
    "\n",
    "$$D_0 = EPS(NI)*(1-b)$$<br>\n",
    "$$b = 1-d $$<br>\n",
    "$$d = \\frac{Div}{EPS}$$\n",
    "d is the dividend pay out ratio\n",
    "b is the retaining rate\n",
    "\n",
    "$$r_e = r_f +\\beta *(R_m - r_f)$$\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "$$\\Delta Equity = Equity * g = RE = NI * b$$\n",
    "\n",
    "第一种方法：$$g = \\frac{NI}{Equity}* b = ROE * b$$\n",
    "第二种方法:根据历史数据"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "2016 10, 2020 20?\n",
    "\n",
    "10(1+g)^4=20"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n",
     "is_executing": false
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [
    {
     "data": {
      "text/plain": "1.189207115002721"
     },
     "metadata": {},
     "output_type": "execute_result",
     "execution_count": 7
    }
   ],
   "source": [
    "def calculate_g(b_y,e_y,b_d,e_d):\n",
    "    n = e_y - b_y\n",
    "    result = pow(e_d/b_d,1/n)-1\n",
    "    return result\n",
    "\n",
    "calculate_g(2016,2020,10,20)   \n",
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n",
     "is_executing": false
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [
    {
     "data": {
      "text/plain": "2.0"
     },
     "metadata": {},
     "output_type": "execute_result",
     "execution_count": 6
    }
   ],
   "source": [
    "pow(16,1/4)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n",
     "is_executing": false
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "source": [],
    "metadata": {
     "collapsed": false
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}